package com.nmc.service.manager.impl;



import com.nmc.service.dao.LookupDao;
import com.nmc.service.manager.LookupManager;
import com.nmc.service.model.LabelValue;
import com.nmc.service.model.Role;

import java.util.ArrayList;
import java.util.List;


/**
 * Implementation of LookupManager interface to talk to the persistence layer.
 *
 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
 */
public class LookupManagerImpl implements LookupManager {
    LookupDao lookupDao;

    /**
     * {@inheritDoc}
     */
    public List<LabelValue> getAllRoles() {
        List<Role> roles = lookupDao.getRoles();
        List<LabelValue> list = new ArrayList<LabelValue>();

        for (Role role1 : roles) {
            list.add(new LabelValue(role1.getName(), role1.getName()));
        }

        return list;
    }

	/**
	 * @return the lookupDao
	 */
	public LookupDao getLookupDao() {
		return lookupDao;
	}

	/**
	 * @param lookupDao the lookupDao to set
	 */
	public void setLookupDao(LookupDao lookupDao) {
		this.lookupDao = lookupDao;
	}
}
